import { post } from '../http'
import { cherryPick2Dict } from '@/utils/formatResponseData'

/**
 * @description: 违章管理列表
 * @param data
 * @return Promise
 */
export const getList = (data) => post({ url: '/violation/getList', data })

/**
 * @description: 新增违章
 * @param data
 * @return Promise
 */
export const addViolation = (data) => post({ url: '/violation/create', data })

/**
 * @description: 编辑违章
 * @param data
 * @return Promise
 */
export const editViolation = (data) => post({ url: '/violation/update', data })

/**
 * @description: 违章详情
 * @param data
 * @return Promise
 */
export const violationDetail = (data) => post({ url: '', data })

/**
 * @description: 删除违章
 * @param data
 * @return Promise
 */
export const delViolation = (data) => post({ url: '/violation/delete', data })

/**
 * @description: 导出违章
 * @param data
 * @return Promise
 */
export const exportViolation = (data) => post({ url: '/violation/exportExcel', data })

/**
 * @description: 导入违章
 * @param data
 * @return Promise
 */
export const importViolation = (data) => post({ url: '', data })

// 获取关联订单号
export const getRelationOrderNo = (data) => post({ url: '/carInfo/findOrderInTime', data })

// 获取违章详情
export const getViolationDetail = (data) => post({ url: '/violation/detail', data })

// 查询页面统计数据
export const getViolationStatistics = (data) => post({ url: '/violation/findCountViolation', data })

// 订单详情
export const getOrder = (data) => post({ url: '/carInfo/orderCarInfo', data })

// 查询催缴记录
export const checkCallRecord = (data) => post({ url: '/violation/urge/list', data })

// 催缴
export const saveCall = (data) => post({ url: '/violation/urge/edit', data })

/** 关闭违章单 */
export const closeViolation = (data) => post({ url: '/violation/close', data })

/** 添加行驶证记录 */
export const addDrivingRecord = (data) => post({ url: '/violation/driveLicenseRecord', data })

/** 获取总量数据 */
export const getViolationCount = (data) => post({ url: '/violation/handleCount', data })

// 添加违章标签
export const addViolationTag = (data) => post({ url: '/violation/label/add', data })

/**
 * 获取违章押金收取方式
 */
export const inExpWayEnums = () =>
  post({
    url: '/violation/getEnums',
    format: (res) => {
      res.result.violationLabelEnum.forEach((item) => {
        item.value = item.name
      })

      return cherryPick2Dict(res.result, {
        inExpWayList: 'inExpWayList',
      })
    },
  })

// 违章查询列表
export const getViolationQueryList = (data) => post({ url: '/violation/queryAccountList', data })
// 新增/编辑违章查询
export const addViolationQuery = (data) => post({ url: '/violation/createQueryEp', data })
// 查询企业账号最后同步时间
export const getAccountLastSyncDate = (data) => post({ url: '/violation/getAccountLastSyncDate', data })
// 查询账户余额
export const getViolationQueryBalance = (data) => post({ url: '/violation/chackAccountAmount', data })

// 查询车辆关联列表
export const getViolationQueryCarCount = (data) => post({ url: '/violation/queryAccountCarList', data })

// 违章查询-查询记录-列表
export const getViolationRecordList = (data) => post({ url: '/violation/queryRecord', data })
// 导出违章查询记录
export const exportQueryRecord = (data) => post({ url: '/violation/queryRecord/exportExcel', data })
// 查询违章有效查询总数
export const queryRecordValidQueryCount = (data) => post({ url: '/violation/queryRecord/validQueryCount', data })
// 查询上智广链登录二维码
export const getZgLoginQrcode = (data) => post({ url: '/violation/getSzglLoginReCode', data })
// 查询账户信息
export const getAccountInfo = (data) => post({ url: '/violation/accountInfo', data })
// 关联车辆列表
export const getViolationQueryCarList = (data) => post({ url: '/violation/getAccountCanBindCar', data })
// 下载导入模板
export const downloadTemplate = () => post({ url: '/violation/queryAccount/importExcel', data: {} })

// 查询违章企业账号详情
export const getQueryAccountInfo = (data) => post({ url: '/violation/getAccountInfo', data })
// 查询违章
export const queryViolation = (data) => post({ url: '/violation/queryByAccountId', data })

// 查询企业名称
export const queryCompanyName = (data) => post({ url: '/violation/queryEpList', data })

// 违章短信列表查询
export const getSmsList = (data) => post({ url: '/violation/getSmsList', data })
// 违章短信列表查询导出
export const exportSmsList = (data) => post({ url: '/violation/exportSmsList', data })
